<!DOCTYPE html>
<html>
	<head>
		<meta content="application/xhtml+xml;charset=UTF-8" http-equiv="Content-Type">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>我的速运-注册</title>

		<link rel="stylesheet" type="text/css" href="css/styleloginsign.css">
		<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css">

		<script  type="text/javascript" src="js/jquery.min.js"></script>
		<script  type="text/javascript" src="js/bootstrap.min.js"></script>
		<script  type="text/javascript" src="js/self/effect.js"></script>
		<script  type="text/javascript" src="js/angular.min.js" ></script>

		<!--[if IE]>
    <script  type="text/javascript" src="js/html5.js"></script>
    <script  type="text/javascript" src="js/respond.min.js"></script>
    <![endif]-->
	</head>
	<body>
		<!--head-->
		<div class="loginnav">
			<nav class="navbar navbar-default">
				<div class="container">
					<div class="navbar-header">
						<a class="navbar-brand" href="#"><img src="images/icon/logo.png"></a>
						<span class="logintitle">用户注册</span>
					</div>
				</div>
			</nav>
		</div>
		
		<div class="container">
			<!--mainsignup-->
			<section class="mainsign">
				<div class="headnav">
									
				</div>
				<!--添加ng入口,以及为当前元素绑定控制器-->
	            <div class="signup" ng-app="signupApp" ng-controller="signupController">
		            <div class="col-md-9 signupbox">
						<form id="customerForm" class="form col-md-6" action="customer_regist.action" method="post">
							<div class=" form-group">
								<label for="inputaccount" class="col-sm-3 control-label"><b>*</b>手机号</label>
								<div class="col-sm-8">
									<input type="text" name="telephone" class="form-control" id="inputaccount" placeholder="请输入手机号" ng-model="telephone">
								</div>
							</div>
							<div class="form-group">
								<label for="inputaccount" class="col-sm-3 control-label"><b>*</b>验证码</label>
								<div class="col-sm-5">
									<input type="text" name="checkcode" class="form-control" id="inputaccount" placeholder="请输入验证码">
								</div>
								<div class="col-sm-3 song">
									<!--给按钮绑定一个事件,以及给按钮绑定一个值-->
									<a class="btn btn-default" ng-click="getCheckCode(telephone)" ng-bind="btnMsg"></a>
								</div>
							</div>
							<div class="form-group">
								<label for="inputaccount" class="col-sm-3 control-label"><b>*</b>密码</label>
								<div class="col-sm-8">
									<input type="password" name="password" class="form-control" id="inputaccount" placeholder="6-16位数字或英文字母">
									<p class="text-right grey">安全强度：*****</p>
								</div>
							</div>
							
							<div class="form-group">
								<label for="inputaccount" class="col-sm-3 control-label"><b>*</b>确认密码</label>
								<div class="col-sm-8">
									<input type="password" name="repassword" class="form-control" id="inputaccount" placeholder="6-16位数字或英文字母">
								</div>
							</div>
							<div class="form-group">
								<label for="inputaccount" class="col-sm-3 control-label"><b>*</b>绑定邮箱</label>
								<div class="col-sm-8">
									<input type="email" name="email" class="form-control" id="inputemail" placeholder="请输入需要绑定的邮箱">
								</div>
							</div>
							<div class="form-group">							
								<div class="col-sm-offset-3 col-sm-8 song">
									<div class="checkbox">
										<label>
										    <input type="checkbox"> 查看并同意<a href="#"> 《速运快递服务协议》</a>
										</label>
									</div>
								</div>
							</div>
							<div class="form-group signbtn">							
								<div class="col-sm-offset-3 col-sm-8 song">
									<a class="btn btn-danger"  href="javascript:$('#customerForm').submit();">注册</a>
								</div>
							</div>
						</form>
					</div>
					
			      	<div class="col-md-3 introbox">
				      	<div class="signintro">
				      	<h5 class="redtext">注册成为速运会员，您可以享受更多的服务！</h5>
				      	<ul>
				      		<li class="list-group">积分奖励，电子运单专享特权</li>
				      		<li class="list-group">快速理赔，保价优惠</li>
				      		<li class="list-group">大陆偏远地区附加费减免</li>
				      		<li class="list-group">快件路由订阅，快件信息管理，批量下单</li>
				      	</ul>
				      	</div>
			      	</div>
				</div>
			</section>
		</div>
		
		<!--foot-->
		<footer>
			<section class="copyright size12">
				<div class="container">
					<p class="text-center">地址：北京市昌平区建材城西路金燕龙办公楼一层 邮编：100096 电话：400-618-4000 传真：010-82935100 </p>
					<p class="text-center">京ICP备08001421号京公网安备110108007702</p>
				</div>
			</section>
		</footer>
		
		<script type="text/javascript">
			//声明模型
			var signupApp = angular.module("signupApp",[]);
			//声明控制器
			signupApp.controller("signupController",["$scope","$http",function($scope,$http){
				//给btn赋初始值
				$scope.btnMsg="发送验证码";
				//给btn初始化一个状态
				var flag = true;
				//初始化倒计时时间
				var second = 60;
				//定义一个计时器
				var secondInterval;
				
				//点击按钮后触发的事件
				$scope.getCheckCode = function(telephone){
					//如果btn的状态为false 就不让发送验证码
					if(flag==false){
						return;
					}
					//判断填写的手机号是否符合,符合就给手机发送短信
					var regex = /^1[34578]\d{9}$/;
					if(regex.test(telephone)){
						//如果手机号符合规范,给手机发送短信
						$http({
							//请求的方式
							method:'GET',
							//请求的地址
							url:'customer_sendSms',
							//请求的参数
							params:{
								telephone:telephone
							}
						}).error(function(data,status,headers,config){
							alert("发送短信出错,请联系管理员");
						});
						
					}else{
						alert("请输入正确的手机号码");
						return;
					}
					//将btn的状态修改为false
					flag = false;
					//开启计时器
					secondInterval = setInterval(function(){
						if(second<0){
							//给btn赋初始值
							$scope.btnMsg="重发验证码";
							//刷新btn的值
							$scope.$digest();
							//将btn的状态修改为true
							flag = true;
							//初始化倒计时时间
							second = 60;
							//关闭定时器
							clearInterval(secondInterval);
						}else{
							//显示读秒
							$scope.btnMsg = second+"s后重发";
							//刷新btn的值
							$scope.$digest();
							second--;
						}
					},1000);
				}
			}]);
		</script>
	</body>
</html>
